package model

import (
	"gorm.io/gorm"
	"time"
)

type House struct {
	Id        uint           `gorm:"column:id;type:bigint UNSIGNED;primaryKey;not null;" json:"id"`
	Title     string         `gorm:"column:title;type:varchar(255);not null;" json:"title"`
	Price     uint           `gorm:"column:price;type:int UNSIGNED;not null;default:0;" json:"price"`
	Area      uint           `gorm:"column:area;type:int UNSIGNED;not null;default:0;" json:"area"`
	City      string         `gorm:"column:city;type:varchar(255);not null;" json:"city"`
	Address   string         `gorm:"column:address;type:varchar(255);not null;" json:"address"`
	Town      string         `gorm:"column:town;type:varchar(255);comment:小区名;not null;" json:"town"` // 小区名
	HouseImg  string         `gorm:"column:house_img;type:varchar(255);not null;" json:"house_img"`
	VideoUrl  string         `gorm:"column:video_url;type:varchar(255);not null;" json:"video_url"`
	Status    uint           `gorm:"column:status;type:int UNSIGNED;comment:房源状态：1：在售 2：已售 3：已下架;not null;default:1;" json:"status"` // 房源状态：1：在售 2：已售 3：已下架
	UserId    uint           `gorm:"column:user_id;type:bigint UNSIGNED;not null;default:0;" json:"user_id"`
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" json:"deleted_at"`
}

func (h *House) TableName() string {
	return "house"
}
